import { RoleAttributeType } from "../RoleEnum";

/** 角色数值装饰器 */
export class RoleNumericDecorator {
    /**
     * 创建修饰器数据 
     * @param data  {"hp_max": 10}
     */
    static create(data: any): RoleNumericDecorator[] {
        var effects: RoleNumericDecorator[] = [];
        for (let key in data) {
            let value = data[key];
            let rnd = new RoleNumericDecorator(key as RoleAttributeType, value);
            effects.push(rnd);
        }
        return effects;
    }

    /** 属性类型 */
    attribute: RoleAttributeType = null!;
    /** 属性数值 */
    value: number = 0;

    constructor(attribute: RoleAttributeType, value: number) {
        this.attribute = attribute;
        this.value = value;
    }
}
